package xju_3_4.entity;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class Teacher {
    @Value("1")
    private Integer id;
    @Value("lisi")
    private String name;
    @Value("Web")
    private String course;
    @Value("JavaEE")
    private String msg;

    public Teacher() {
        System.out.println("Teacher constructor 创建了");
    }

    public Teacher(Integer id, String name, String course, String msg) {
        this.id = id;
        this.name = name;
        this.course = course;
        this.msg = msg;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    // 自定义
    public void teach() {
        System.out.println("老师在讲解"+ msg);
    }

    @Override
    public String toString() {
        return "Teacher{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", course='" + course + '\'' +
                ", msg='" + msg + '\'' +
                '}';
    }
}
